package com.leesche.zcsp.node.web.vo;

import com.leesche.zcsp.node.utils.web.mathematical.MoneyCount;
import com.leesche.zcsp.node.web.constants.Constants;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author Jerry Chan
 * @version V1.0
 * @Title: node
 * @Package com.leesche.zcsp.node.web.vo
 * @Description:( 清零账目统计 )
 * @date 2016年11月03日 11:55
 */
public class FrequencyStatistic implements Serializable {

    private String placeName;
    private Long deviceid;
    private String deviceName;
    private Integer index;
    private List<StatisticDetails> statisticDetails;

    public FrequencyStatistic(String placeName, Long deviceid, String deviceName, List<StatisticDetails> statisticDetails, Integer index) {
        this.placeName = placeName;
        this.deviceid = deviceid;
        this.deviceName = deviceName;
        this.statisticDetails = statisticDetails;
        this.index = index;
    }

    public String getPlaceName() {
        return placeName;
    }

    public void setPlaceName(String placeName) {
        this.placeName = placeName;
    }

    public Long getDeviceid() {
        return deviceid;
    }

    public void setDeviceid(Long deviceid) {
        this.deviceid = deviceid;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public List<StatisticDetails> getStatisticDetails() {
        return statisticDetails;
    }

    public void setStatisticDetails(List<StatisticDetails> statisticDetails) {
        this.statisticDetails = statisticDetails;
    }

    public Integer getIndex() {
        return index;
    }

    public void setIndex(Integer index) {
        this.index = index;
    }

    /**
     * @author Jerry
     * @Title: StatisticDetails
     * @Description: TODO(统计详情内部类)
     * @date 2016-11-03 12:31:44
     */
    public class StatisticDetails {
        private Long balanceid;
        private Long coinTotal;
        private String cachTotal;
        private String wechatPayTotal;
        private String alipayPayTotal;

        private Long outGameCoinAccount;
        private Long outGiftAccount;
        private Long gameCoinQuantity; //gameCoinBalance
        private Long remotelyOutGameCoinAccount;

        private Date frequencyTime;

        private long oneBalance = 0;
        private long fiveBalance = 0;
        private long tenBalance = 0;
        private long twentyBalance = 0;
        private long fiftyBalance = 0;
        private long hundredBalance = 0;

        private long billCount = 0;
        private String subtotal;

        public StatisticDetails() {
            this.toZero();
        }

        /**
         * @param remotelyOutGameCoinAccount 远程补币
         * @param gameCoinQuantity           投入游戏币的数量
         * @param outGiftAccount             出礼品的数量
         * @param outGameCoinAccount         出游戏币的数量
         * @Title: 构造方法
         * @Description: TODO(初始化游戏币与礼品的数量)
         * @author Jerry
         * @date 2016-11-04 10:35:30
         */
        public StatisticDetails(Long remotelyOutGameCoinAccount, Long gameCoinQuantity, Long outGiftAccount, Long outGameCoinAccount) {
            this.remotelyOutGameCoinAccount = remotelyOutGameCoinAccount;
            this.gameCoinQuantity = gameCoinQuantity;
            this.outGiftAccount = outGiftAccount;
            this.outGameCoinAccount = outGameCoinAccount;
        }

        /**
         * @param balanceid 清零账目编号
         * @param coinTotal 硬币总数
         * @param 剩下的自己看~   没空写
         * @Title: StatisticDetails
         * @Description: TODO(设置各项统计)
         * @author Jerry
         * @date 2016-11-03 03:31:47
         */
        public StatisticDetails(Long balanceid, Long coinTotal, Long cachTotal, Long wechatPayTotal, Long alipayPayTotal, Long outGameCoinAccount, Long outGiftAccount, Long remotelyOutGameCoinAccount, Date frequencyTime) {
            this.balanceid = balanceid;

            statisticOtherPay(coinTotal, wechatPayTotal, alipayPayTotal);

            this.cachTotal = Constants.DECIMAL_FORMAT.format(new BigDecimal(cachTotal).doubleValue());
            this.outGameCoinAccount = outGameCoinAccount;
            this.outGiftAccount = outGiftAccount;
            this.remotelyOutGameCoinAccount = remotelyOutGameCoinAccount;
            this.frequencyTime = frequencyTime;
        }

        /**
         * @Title: statisticOtherPay
         * @Description: TODO( 统计其他支付方式 )
         * @author Jerry Chan
         * @date 2016-11-08 06:22:52
         * @param coinTotal 硬币总数
         * @param wechatPayTotal 微信支付总额
         * @param alipayPayTotal 支付宝支付总额
         */
        public void statisticOtherPay(Long coinTotal, Long wechatPayTotal, Long alipayPayTotal){
            this.coinTotal = coinTotal;
            this.wechatPayTotal = Constants.DECIMAL_FORMAT.format(MoneyCount.percentageCount(wechatPayTotal,Constants.percentage));
            this.alipayPayTotal = Constants.DECIMAL_FORMAT.format(MoneyCount.percentageCount(alipayPayTotal,Constants.percentage));
        }

        /**
         * @Title: statisticSubtotal
         * @Description: TODO(统计小计总额)
         * @author Jerry
         * @date 2016-11-03 06:54:44
         */
        public Long statisticSubtotal() {
            Long billmoney = (this.oneBalance * 1) + (this.fiveBalance * 5) + (this.tenBalance * 10) + (this.twentyBalance * 20) + (this.fiftyBalance * 50) + (this.hundredBalance * 100);
            this.subtotal = Constants.DECIMAL_FORMAT.format(billmoney);
            return billmoney;
        }

        /**
         * @param oneBalance     一元面额数量
         * @param fiveBalance    五元面额数量
         * @param tenBalance     十元面额数量
         * @param twentyBalance  二十元面额数量
         * @param fiftyBalance    五十元面额数量
         * @param hundredBalance 一百元面额数量
         * @Title: statisticCash
         * @Description: TODO(纸币面额统计)
         * @author Jerry
         * @date 2016-11-01 09:53:29
         */
        public void statisticCash(Long oneBalance, Long fiveBalance, Long tenBalance, Long twentyBalance, Long fiftyBalance, Long hundredBalance) {
            this.oneBalance = oneBalance;
            this.fiveBalance = fiveBalance;
            this.tenBalance = tenBalance;
            this.twentyBalance = twentyBalance;
            this.fiftyBalance = fiftyBalance;
            this.hundredBalance = hundredBalance;
            //纸币张数
            this.billCount = this.oneBalance + this.fiveBalance + this.tenBalance + this.twentyBalance + this.fiftyBalance + this.hundredBalance;
        }

        /**
         * @Title: toZero
         * @Description: TODO(数据归零)
         * @author Jerry
         * @date 2016-11-03 03:30:48
         */
        public void toZero() {
            this.coinTotal = 0L;
            this.cachTotal = "0.00";
            this.wechatPayTotal = "0.00";
            this.alipayPayTotal = "0.00";
            this.outGameCoinAccount = 0L;
            this.outGiftAccount = 0L;
            this.remotelyOutGameCoinAccount = 0L;
            this.frequencyTime = null;
        }

        public Long getBalanceid() {
            return balanceid;
        }

        public void setBalanceid(Long balanceid) {
            this.balanceid = balanceid;
        }

        public Long getCoinTotal() {
            return coinTotal;
        }

        public void setCoinTotal(Long coinTotal) {
            this.coinTotal = coinTotal;
        }

        public String getCachTotal() {
            return cachTotal;
        }

        public void setCachTotal(String cachTotal) {
            this.cachTotal = cachTotal;
        }

        public String getWechatPayTotal() {
            return wechatPayTotal;
        }

        public void setWechatPayTotal(String wechatPayTotal) {
            this.wechatPayTotal = wechatPayTotal;
        }

        public String getAlipayPayTotal() {
            return alipayPayTotal;
        }

        public void setAlipayPayTotal(String alipayPayTotal) {
            this.alipayPayTotal = alipayPayTotal;
        }

        public Long getOutGameCoinAccount() {
            return outGameCoinAccount;
        }

        public void setOutGameCoinAccount(Long outGameCoinAccount) {
            this.outGameCoinAccount = outGameCoinAccount;
        }

        public Long getOutGiftAccount() {
            return outGiftAccount;
        }

        public void setOutGiftAccount(Long outGiftAccount) {
            this.outGiftAccount = outGiftAccount;
        }

        public Long getRemotelyOutGameCoinAccount() {
            return remotelyOutGameCoinAccount;
        }

        public void setRemotelyOutGameCoinAccount(Long remotelyOutGameCoinAccount) {
            this.remotelyOutGameCoinAccount = remotelyOutGameCoinAccount;
        }

        public Date getFrequencyTime() {
            return frequencyTime;
        }

        public void setFrequencyTime(Date frequencyTime) {
            this.frequencyTime = frequencyTime;
        }

        public long getOneBalance() {
            return oneBalance;
        }

        public void setOneBalance(long oneBalance) {
            this.oneBalance = oneBalance;
        }

        public long getFiveBalance() {
            return fiveBalance;
        }

        public void setFiveBalance(long fiveBalance) {
            this.fiveBalance = fiveBalance;
        }

        public long getTenBalance() {
            return tenBalance;
        }

        public void setTenBalance(long tenBalance) {
            this.tenBalance = tenBalance;
        }

        public long getTwentyBalance() {
            return twentyBalance;
        }

        public void setTwentyBalance(long twentyBalance) {
            this.twentyBalance = twentyBalance;
        }

        public long getFiftyBalance() {
            return fiftyBalance;
        }

        public void setFiftyBalance(long fiftyBalance) {
            this.fiftyBalance = fiftyBalance;
        }

        public long getHundredBalance() {
            return hundredBalance;
        }

        public void setHundredBalance(long hundredBalance) {
            this.hundredBalance = hundredBalance;
        }

        public Long getGameCoinQuantity() {
            return gameCoinQuantity;
        }

        public void setGameCoinQuantity(Long gameCoinQuantity) {
            this.gameCoinQuantity = gameCoinQuantity;
        }

        public long getBillCount() {
            return billCount;
        }

        public void setBillCount(long billCount) {
            this.billCount = billCount;
        }

        public String getSubtotal() {
            return subtotal;
        }

        public void setSubtotal(String subtotal) {
            this.subtotal = subtotal;
        }
    }

}
